<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Chr() - Syntax &amp; Usage | AutoHotkey</title>
<meta name="description" content="The Chr function returns the string (usually a single character) corresponding to the character code indicated by the specified number." />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>Chr()</h1>

<p>Returns the string (usually a single character) corresponding to the character code indicated by the specified number.</p>

<pre class="Syntax">String := <span class="func">Chr</span>(Number)</pre>
<h2>Parameters</h2>
<dl>

  <dt>Number</dt>
  <dd><p>If Unicode is supported, <em>Number</em> is a Unicode character code between 0 and 0x10FFFF (or 0xFFFF prior to <span class="ver">[v1.1.21]</span>); otherwise it is an ANSI character code between 0 and 255.</p></dd>

</dl>

<h2>Return Value</h2>
<p>This function returns a string corresponding to <em>Number</em>. If <em>Number</em> is not in the valid range of character codes, an empty string is returned.</p>

<h2>Remarks</h2>
<p>This function supersedes <a href="Transform.htm#Chr">Transform, OutputVar, Chr</a>.</p>
<p>The meaning of character codes greater than 127 depends on the <a href="../Compat.htm#Format">string encoding</a> in use, which in turn depends on whether a <a href="../Variables.htm#IsUnicode">Unicode or ANSI</a> executable is in use.</p>
<p>Common character codes include 9 (tab), 10 (linefeed), 13 (carriage return), 32 (space), 48-57 (the digits 0-9), 65-90 (uppercase A-Z), and 97-122 (lowercase a-z).</p>

<h2>Related</h2>
<p><a href="Transform.htm">Transform</a>, <a href="Ord.htm">Ord()</a>, <a href="Asc.htm">Asc()</a></p>

<h2>Examples</h2>
<div class="ex" id="ExBasic">
<p><a href="#ExBasic">#1</a></p>
<pre>MsgBox, % Chr(116) <em>; Shows "t".</em></pre>
</div>

</body>
</html>
